package com.gzq.singleton.exam00;

import java.io.Serializable;

/**
 * 懒汉式——方法锁单例模式版。防止反射、序列化入侵参见{@link EhStaticCodeBlock}
 */
public class LhMethodLock implements Serializable {
    private static LhMethodLock singleton = null;

    private LhMethodLock() {
    }

    public synchronized static LhMethodLock getSingleton() {
        if (singleton == null) {
            singleton = new LhMethodLock();
        }
        return singleton;
    }
}
